$(document).ajaxError(function(event,xhr,options,exc){
    if(xhr.status==401){
        location.href = "blog_login.html";
    }
});

$(document).ajaxSend(function(event,xhr,options){
    let userToken = localStorage.getItem("token");
    xhr.setRequestHeader("token", userToken);
});